]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Fix VPN toggle not working when clicking the switch
authorAlynx Zhou <alynx.zhou@gmail.com>
Fri, 9 May 2025 04:16:52 +0000 (12:16 +0800)
committerMarge Bot <marge-bot@gnome.org>
Sat, 24 May 2025 17:36:51 +0000 (17:36 +0000)
VPN activation is triggered by clicking/touching the item, however,
the switch is reactive and blocks clicking/touching event so item won't
be activated. Manually activate item when switch is toggled to fix that.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8204
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3711>

js/ui/status/network.js

index ee9b2293759248fc43a0a080d99336640b8daeff..69337ca993c672b53730d07c73116cc718d177e1 100644 (file)
@@ -1323,6 +1323,16 @@ const NMVpnConnectionItem = GObject.registerClass({
         this.bind_property('is-active',
             this._switch, 'state',
             GObject.BindingFlags.SYNC_CREATE);
+
+        // Switch handle is reactive, so events don't propagate to the item;
+        // activate it manually in that case
+        this._switch.connect('notify::state', () => {
+            if (this.is_active === this._switch.state)
+                return;
+
+            this.activate();
+        });
+
         this.bind_property('name',
             this._label, 'text',
             GObject.BindingFlags.SYNC_CREATE);